home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group94a.txt / 000097_icon-group-sender _Sun Apr 24 16:51:23 1994.msg < prev    next >
Internet Message Format  |  1994-08-19  |  2KB

  1. Received: by cheltenham.cs.arizona.edu; Sun, 24 Apr 1994 13:53:14 MST
  2. From: <janpeter@mpi.kun.nl>
  3. Message-Id: <9404241551.AA17073@mpix10.mpi.kun.nl>
  4. To: icon-group@cs.arizona.edu
  5. Subject: Re: is this a bug? 
  6. Date: Sun, 24 Apr 94 16:51:23 +0100
  7. X-Mts: smtp
  8. Status: R
  9. Errors-To: icon-group-errors@cs.arizona.edu
  10.  
  11. First of all, thank you for the help in understanding
  12. Icon table / list semantics. I now see what the problem
  13. was.
  14.  
  15. Nevin Liber writes:
  16. > Jan Peter de Ruiter proudly drove the following message along the Information SuperHype way(TM) at breakneck speeds:
  17.  
  18. I can see no indication of "proudness" in my posting. I specifically
  19. pointed out that lack of understanding of Icon on my part is a
  20. potential cause for my problem. 
  21.  
  22. As John David Stone (stone@math.grin.edu) and Steve Wampler
  23. (swampler@noao.edu) also pointed out, the thing I didn't realize
  24. is that the initialisation 
  25.     t := table([])
  26. makes all table entries point at the *same* empty list.
  27.  
  28. Well, I understand now, but I must honestly say I don't 
  29. like it. The denotation [] looks like a *value* to me,
  30. but it isn't. 
  31.  
  32. I see that the statement
  33.  
  34.     l1 := l2 := list()
  35.  
  36. will make "pointers" to the same list, and I can appreciate
  37. the performance reasons behind this. What I don't like it
  38. the difference between initialisation and assignment in
  39. tables, for it can lead to confusing effects. 
  40.  
  41. For example, the following fragments do not have the same
  42. meaning:
  43.  
  44. # first fragment
  45. t := table([])
  46. put(t[1],"john")
  47. put(t[2],"mary")
  48.  
  49. # second fragment
  50. t := table([])
  51. t[1] |||:= ["john"]
  52. t[2] |||:= ["mary"]
  53.  
  54. Which is a pity, I think, for a higher level language where
  55. you're supposed to be free of these details. This is the kind
  56. of problem I expect to have in C++, but not in Icon.
  57.  
  58. But I am fully aware of the fact that I'll have to live with it.
  59. And I can live with it, now I know what's going on.
  60.  
  61. Greetings,
  62.  
  63. Jan
  64.